<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:ry="">
	<head>
		<th:block th:include="include :: header('参数列表')" />
		<th:block th:include="include :: WdatePicker-js" />
		<style type="text/css">
		#bootstrap-table th {
			text-align: center;
		}
		</style>
	</head>
	<body class="gray-bg">
	     <div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<form id="config-form">
						<div class="select-list">
							<ul>
								<li>
									参数名称：<input type="text" name="config_name"/>
								</li>
								<li>
									参数键名：<input type="text" name="config_key"/>
								</li>
								<li>
									系统内置：<ry:selectDict dictType="sys_yes_no" name="config_type" headLabel="全部" headValue="" value=""/>
								</li>
								<li class="select-time">
									<label>创建时间： </label>
									<input type="text" name="start_time" placeholder="开始时间" onclick="WdatePicker();" />
									<span>-</span>
									<input type="text" name="end_time" placeholder="结束时间" onclick="WdatePicker();" />
								</li>
								<li>
									<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
									<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
								</li>
							</ul>
						</div>
						<input type="hidden" id="orderByColumn" name="orderByColumn" value="a.config_id"/>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">
			        <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:param:add">
			            <i class="fa fa-plus"></i> 新增
			        </a>
			        <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:param:remove">
			            <i class="fa fa-remove"></i> 删除
			        </a>
			        <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:param:export">
			            <i class="fa fa-download"></i> 导出
			        </a>
                    <a class="btn btn-danger" onclick="clearCache()" shiro:hasPermission="system:config:remove">
                        <i class="fa fa-refresh"></i> 清理缓存
                    </a>
		        </div>
		        <div class="col-sm-12 select-table table-striped">
		            <table id="bootstrap-table"></table>
		        </div>
		    </div>
		</div>
	    <th:block th:include="include :: footer" />
	    <script th:inline="javascript">
	        var editFlag = [[${@permission.hasPermi('system:param:edit')}]];
	        var removeFlag = [[${@permission.hasPermi('system:param:remove')}]];
	        var datas = [[${@dict.getType('sys_yes_no')}]];
	        var prefix = ctx + "system/param";

	        $(function() {
	            var options = {
	                url: prefix + "/list",
	                createUrl: prefix + "/add",
	                updateUrl: prefix + "/edit/{id}",
	                removeUrl: prefix + "/remove",
	                exportUrl: prefix + "/export",
	                modalName: "参数",
	                columns: [{
		                    checkbox: true
		                },
		                {
		                    field: 'config_id',
		                    title: '参数主键',
		                    align: 'center'
		                },
		                {
		                    field: 'config_name',
		                    title: '参数名称',
			            	sortable: true,
		                    formatter: function(value, row, index) {
		                    	return $.table.tooltip(value);
		                    }
		                },
		                {
		                    field: 'config_key',
		                    title: '参数键名',
		                    formatter: function(value, row, index) {
		                    	return $.table.tooltip(value);
		                    }
		                },
		                {
		                    field: 'config_value',
		                    title: '参数键值'
		                },
		                {
		                    field: 'config_type',
		                    title: '系统内置',
		                    align: 'center',
		                    formatter: function(value, row, index) {
		                    	return $.table.selectDictLabel(datas, value);
		                    }
		                },
		                {
		                    field: 'remark',
		                    title: '备注',
		                    formatter: function(value, row, index) {
		                    	return $.table.tooltip(value, 10, "open");
		                    }
		                },
		                {
		                    field: 'create_time',
		                    title: '创建时间',
		                    align: 'center'
		                },
		                {
		                    title: '操作',
		                    align: 'center',
		                    formatter: function(value, row, index) {
		                        var actions = [];
		                        actions.push('<a class="btn btn-success btn-xs '+editFlag+'" href="javascript:void(0)" onclick="$.operate.edit(\''+row.config_id+'\')"><i class="fa fa-edit"></i>修改</a> ');
		                        actions.push('<a class="btn btn-danger btn-xs '+removeFlag+'" href="javascript:void(0)" onclick="$.operate.remove(\''+row.config_id+'\')"><i class="fa fa-remove"></i>删除</a>');
		                        return actions.join('');
		                    }
		                }
		        	]
	            };
	            $.table.init(options);
	        });

            /** 清理参数缓存 */
            function clearCache() {
                $.operate.get(prefix + "/clearCache");
            }
	    </script>
	</body>
</html>